//函数组合 调试
//例如： NEVER SAY DIE ---》 never-say-die

const _ = require('lodash')

//调试打印
const log = v =>{
    console.log(v)
    return v
}
//跟踪函数打印日志
const trace = _.curry((tag, v) => {
    console.log(tag, v)
    return v
}) 

const split = _.curry((sep, str) => _.split(str, sep))
const join = _.curry((sep, array) => _.join(array, sep))

const map = _.curry((fn, array) => _.map(array,fn))

//调试
//const f = _.flowRight(join('-'), log, _.toLower,split(' '))
// const f = _.flowRight(join('-'), map(_.toLower),split(' '))

const f = _.flowRight(join('-'), trace('map 之后'), map(_.toLower), trace('split 之后'), split(' '))

console.log(f('NEVER SAY DIE'))

